<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('库存明细列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>仓库：</label>
                            <select id="warehouseId" name="warehouseId" style="width: 200px">
                                <option value="01">托盘库</option>
                                <option value="02">料箱库</option>
                            </select>
                        </li>
                        <li>
                            <label>库存编号：</label>
                            <input type="text" name="stockId"/>
                        </li>
                        <li>
                            <label>储位ID：</label>
                            <input type="text" name="cargoSpaceId"/>
                        </li>
                        <li>
                            <label>批号：</label>
                            <input type="text" name="lotNo"/>
                        </li>
                        <!--                            <li>-->
                        <!--                                <label>入库时间：</label>-->
                        <!--                                <input type="text" name="inDate"/>-->
                        <!--                            </li>-->
                        <!--                            <li>-->
                        <!--                                <label>回流时间：</label>-->
                        <!--                                <input type="text" name="backDate"/>-->
                        <!--                            </li>-->
                                                    <li>
                                                        <label>物资ID：</label>
                                                        <input type="text" name="productId"/>
                                                    </li>
                        <!--                            <li>-->
                        <!--                                <label>数量：</label>-->
                        <!--                                <input type="text" name="quantity"/>-->
                        <!--                            </li>-->
                        <!--                            <li>-->
                        <!--                                <label>作业ID：</label>-->
                        <!--                                <input type="text" name="jobId"/>-->
                        <!--                            </li>-->
                        <li>
                            <label>托盘条码：</label>
                            <input type="text" name="trayCode"/>
                        </li>
                        <!--                            <li>-->
                        <!--                                <label>出库数量：</label>-->
                        <!--                                <input type="text" name="outQuantity"/>-->
                        <!--                            </li>-->
                        <!--                            <li>-->
                        <!--                                <label>入库子单：</label>-->
                        <!--                                <input type="text" name="stockinDetailId"/>-->
                        <!--                            </li>-->
                        <!--                            <li>-->
                        <!--                                <label>入库单：</label>-->
                        <!--                                <input type="text" name="stockinId"/>-->
                        <!--                            </li>-->
                        <!--                            <li>-->
                        <!--                                <label>供应商：</label>-->
                        <!--                                <input type="text" name="inClassName"/>-->
                        <!--                            </li>-->
                        <!--                            <li>-->
                        <!--                                <label>重量：</label>-->
                        <!--                                <input type="text" name="inClassId"/>-->
                        <!--                            </li>-->
                        <!--                            <li>-->
                        <!--                                <label>生产时间：</label>-->
                        <!--                                <input type="text" name="classId"/>-->
                        <!--                            </li>-->
                        <li>
                            <label>库存来源：</label>
                            <select name="stockSource" th:with="type=${@dict.getType('stockin_source')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>物料名称：</label>
                            <input type="text" name="lineId"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm"
                               onclick="$.table.search('formId','bootstrap-table')"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm"
                               onclick="$.form.reset('formId','bootstrap-table')"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="search:viewStock:add">-->
            <!--                    <i class="fa fa-plus"></i> 添加-->
            <!--                </a>-->
            <!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="search:viewStock:edit">-->
            <!--                    <i class="fa fa-edit"></i> 修改-->
            <!--                </a>-->
            <!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="search:viewStock:remove">-->
            <!--                    <i class="fa fa-remove"></i> 删除-->
            <!--                </a>-->
            <a class="btn btn-warning" onclick="$.table.exportExcel()" >
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-bordered">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('search:viewStock:edit')}]];
    var removeFlag = [[${@permission.hasPermi('search:viewStock:remove')}]];
    var prefix = ctx + "search/viewStock";
    var productStatus = [[${@dict.getType('product_status')}]];
    var djType = [[${@dict.getType('dj_type')}]];
    var warehouseId = [[${@dict.getType('is_house')}]];
    var stockinSource = [[${@dict.getType('stockin_source')}]];

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "库存明细",
            clickToSelect: true,//是否启用点击选中行
            uniqueId: "stockId",//表主键(用于修改和删除)
            sortName: "stockId",//必加排序 sortOrder: "asc"默认
            columns: [
                {
                    halign: 'center',
                    align: 'center',
                    checkbox: true
                },
                {
                    title: "序号",
                    halign: 'center',
                    align: 'center',
                    width: 55,
                    formatter: function (value, row, index) {
                        //获取每页显示的数量
                        var pageSize = $('#bootstrap-table').bootstrapTable('getOptions').pageSize;
                        //获取当前是第几页
                        var pageNumber = $('#bootstrap-table').bootstrapTable('getOptions').pageNumber;
                        //返回序号，注意index是从0开始的，所以要加上1
                        return pageSize * (pageNumber - 1) + index + 1;

                    }
                },

                {
                    field: 'stockId',
                    title: '库存编号',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'cargoSpaceId',
                    title: '储位ID',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'productStatus',
                    title: '物品状态',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(productStatus, value);
                    }
                },
                {
                    field: 'lotNo',
                    title: '批号',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'inDate',
                    title: '入库时间',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'backDate',
                    title: '回流时间',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'productId',
                    title: '物资ID',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'quantity',
                    title: '数量',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'jobId',
                    title: '作业ID',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'trayCode',
                    title: '托盘条码',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'outQuantity',
                    title: '出库数量',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'stockinDetailId',
                    title: '入库子单ID',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'stockinId',
                    title: '入库单ID',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'inType',
                    title: '入库类型',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(djType, value);
                    }
                },
                {
                    field: 'inClassName',
                    title: '供应商',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'inClassId',
                    title: '重量',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'warehouseId',
                    title: '仓库',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(warehouseId, value);
                    }
                },
                {
                    field: 'classId',
                    title: '生产时间',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                {
                    field: 'stockSource',
                    title: '库存来源',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(stockinSource, value);
                    }
                },
                {
                    field: 'lineId',
                    title: '物料名称',
                    halign: 'center',
                    align: 'center',
                    sortable: true,
                    visible: true
                },
                // {
                //     title: '操作',
                //     halign: 'center',
                //     align: 'center',
                //     formatter: function(value, row, index) {
                //         var actions = [];
                //         actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.stockId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                //         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.stockId + '\')"><i class="fa fa-remove"></i>删除</a>');
                //         return actions.join('');
                //     }
                // }
            ]
        };
        $.table.init(options);
    });
</script>
</body>
</html>